package cate.game.play.skill.active;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;

/**
 * 根据自身已损失的血量提升技能伤害，每损失1%生命值，提高0.4%技能伤害
 */
public class 女巫恶作剧AH extends ActiveHandler{


	private double 损失血量;

	private double 伤害提升;

	//损失血量=100&伤害提升=40
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		损失血量 = args.getDouble("损失血量", 100d);
		伤害提升 = args.getDouble("伤害提升", 0d);
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (损失血量 <= 0) {
			return;
		}
		double exCoeff = skill.owner.attr.total().hpLossRate() / 损失血量 * 伤害提升;
		if (exCoeff <= 0) {
			return;
		}
		effect.addHpCfgByCoeff(exCoeff);
	}
}
